package com.example.tms.service;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.tms.entity.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.tms.mapper.DepartmentMapper;

@Service
public class DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    // 获取所有部门列表
    public List<Department> selectAll() {
        return departmentMapper.selectList(null);
    }
    // 根据ID查询部门
    public Department selectById(Integer id) {
        return departmentMapper.selectById(id);
    }

    // 添加部门
    public int insert(Department department) {
        return departmentMapper.insert(department);
    }

    // 更新部门信息
    public int update(Department department) {
        return departmentMapper.updateById(department);
    }

    // 删除部门
    public int deleteById(Integer id) {
        return departmentMapper.deleteById(id);
    }
}
